import request from '@/config/axios'

export interface AbnormalMaterialsVO {
  id: number
  productNumber: number
  productName: string
  modelSpecification: string
  code: string
  partNumber: number
  deviceOrPartName: string
  drawingNumber: string
  partSpecification: string
  material: string
  specification: string
  netSizeLength: number
  netSizeWidth: number
  cuttingSizeLength: number
  cuttingSizeWidth: number
  planQuantity: number
  dictUnit: string
  completeQuantity: number
  incompleteQuantity: number
  dictProcessName: number
  typeOfWork: number
  dictBaitingType: number
  dictIsMachining: number
  dictMachiningProcess: number
  status: number
  converter: string
  convertTime: Date
  creatorName: string
  updaterName: string
}

// 查询异常物料列表列表
export const getAbnormalMaterialsPage = async (params) => {
  return await request.get({ url: `/order/abnormal-materials/page`, params })
}

// 查询异常物料列表详情
export const getAbnormalMaterials = async (id: number) => {
  return await request.get({ url: `/order/abnormal-materials/get?id=` + id })
}

// 新增异常物料列表
export const createAbnormalMaterials = async (data: AbnormalMaterialsVO) => {
  return await request.post({ url: `/order/abnormal-materials/create`, data })
}

// 修改异常物料列表
export const updateAbnormalMaterials = async (data: AbnormalMaterialsVO) => {
  return await request.put({ url: `/order/abnormal-materials/update`, data })
}

// 删除异常物料列表
export const deleteAbnormalMaterials = async (id: number) => {
  return await request.delete({ url: `/order/abnormal-materials/delete?id=` + id })
}

// 导出异常物料列表 Excel
export const exportAbnormalMaterials = async (data) => {
  return await request.download({ url: `/order/abnormal-materials/export-excel`, data })
}
